package Demo2;

import java.util.Objects;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 34255
 * Date: 2024-05-20
 * Time: 16:47
 */
public class Dog extends Animal implements IRunning,ISwimming{
    public Dog(String name, int age) {
        super(name, age);
    }

    @Override
    public void eat() {
        System.out.println(this.name + " 正在吃狗粮!");
    }

    public void bark(){
        System.out.println(this.name + " 正在汪汪叫!");
    }

    @Override
    public void walk() {
        System.out.println(this.name + " 正在跑!");
    }

    @Override
    public void swim() {
        System.out.println(this.name + " 正在游泳!");
    }

//    @Override
//    public boolean equals(Object obj) {
//        Dog tep = (Dog)obj;
//        return this.name.equals(tep.name)
//                && this.age == tep.age;
//    }

    @Override
    public int hashCode() {
        return Objects.hash(this.name,this.age);
    }

}
